package com.qf.service.impl;

import com.qf.dao.PictureRepository;
import com.qf.pojo.entity.Picture;
import com.qf.pojo.resp.BaseResp;
import com.qf.service.PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @ClassName PictureServiceImpl
 * @Description TODO
 * @Author 非乐
 * @Date 2022/9/28 19:50
 * @Version 1.0
 **/
@Service
public class PictureServiceImpl implements PictureService {

    @Autowired
    PictureRepository pictureRepository;

    @Override
    public BaseResp findList() {
        List<String> list=new ArrayList<String>();
        for (int i=0;i<4;i++){
            int i1 = new Random().nextInt(11);
            System.out.println(i1);
            Picture byId = pictureRepository.findById(i1);
            System.out.println(byId);
            list.add(byId.getImgUrl());
        }
        return new BaseResp(200,"success",list);
    }
}
